package com.itheima.dao;

import com.itheima.pojo.OrderSetting;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;

public interface OrderSettingDao {

    @Insert("insert into t_ordersetting values(null,#{orderDate},#{number},#{reservations})")
    public void add(OrderSetting orderSetting);

    @Select("select count(*) from t_ordersetting where orderDate = #{orderDate}")
    public long findCountByOrderDate(Date orderDate);

    @Update("update t_ordersetting set number = #{number} where orderDate = #{orderDate}")
    public void editNumberByOrderDate(OrderSetting orderSetting);

    @Select("select * from t_ordersetting where orderDate between #{actionDate} and #{lastDate}")
    public List<OrderSetting> getOrderSettingByMonth(@Param("actionDate") String actionDate, @Param("lastDate") String lastDate);

    @Select("select * from t_ordersetting where orderDate = #{date}")
    OrderSetting findOrderSettingByDate(Date date);
}
